package com.threegroup.web.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * 菜品及套餐分类
 *
 * @author kohlerm kohlerm@163.com
 * @since 1.0.0 2022-12-16
 */
@Document(indexName = "category", shards = 5, replicas = 1, createIndex = true)
public class CategoryES {

    /**
     * 主键
     */
    @Id
    @JsonFormat
	private Long id;
    /**
     * 类型   1 菜品分类 2 套餐分类
     */
    @Field(type = FieldType.Auto)
    @JsonFormat
	private Integer type;
    /**
     * 分类名称
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    @JsonFormat
	private String name;
    /**
     * 顺序
     */
    @Field(type = FieldType.Auto)
    @JsonFormat
	private Integer sort;
    /**
     * 创建人
     */
    @Field(type = FieldType.Long)
    @JsonFormat
	private Long creator;
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Field(type = FieldType.Date_Nanos)
	private Date createDate;
    /**
     * 修改人
     */
    @Field(type = FieldType.Long)
    @JsonFormat
	private Long updater;
    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Field(type = FieldType.Date_Nanos)
	private Date updateDate;

    public CategoryES() {
    }

    public CategoryES(Long id, Integer type, String name, Integer sort, Long creator, Date createDate, Long updater, Date updateDate) {
        this.id = id;
        this.type = type;
        this.name = name;
        this.sort = sort;
        this.creator = creator;
        this.createDate = createDate;
        this.updater = updater;
        this.updateDate = updateDate;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Long getCreator() {
        return creator;
    }

    public void setCreator(Long creator) {
        this.creator = creator;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Long getUpdater() {
        return updater;
    }

    public void setUpdater(Long updater) {
        this.updater = updater;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    @Override
    public String toString() {
        return "CategoryES{" +
                "id=" + id +
                ", type=" + type +
                ", name='" + name + '\'' +
                ", sort=" + sort +
                ", creator=" + creator +
                ", createDate=" + createDate +
                ", updater=" + updater +
                ", updateDate=" + updateDate +
                '}';
    }
}